home *** CD-ROM | disk | FTP | other *** search
- Path: cleveland.Freenet.Edu!cj841
- From: cj841@cleveland.Freenet.Edu (Chris Steiner)
- Newsgroups: comp.lang.c++
- Subject: Need help with MSVC++
- Date: 6 Feb 1996 14:19:31 GMT
- Organization: Case Western Reserve University, Cleveland OH (USA)
- Message-ID: <4f7o1j$gr7@madeline.INS.CWRU.Edu>
- NNTP-Posting-Host: nextsun.ins.cwru.edu
-
-
- Please, I really need help on this guys. I'm new at this and desperately
- trying to figure out what to do. I'm using the AppWizard, which seems to have
- firmly put me in over my head, yet with a little hope.
-
- Perhaps I did not explain my problem clearly enough in my first post, so I'll
- try again.
-
- I need, in Visual C++ 1.52, to create a modal dialog box that accesses a
- database. This dialog box must connect to the database as it is opened. I
- may need to prompt the user for the location of the database, so I do not want
- the connection formed until the user selects that particular menu option.
-
- This should be relatively simple. I thought it could be done with code such
- as this:
-
- (in tali.h)
-
- /////////////////////////////////////////////////////////////////////////////
- // CSingleDialog dialog
-
- class CSingleDialog : public CDialog
- {
- // Construction
- public:
- CSingleDialog(CWnd* pParent = NULL); // standard constructor
-
- // Dialog Data
- //{{AFX_DATA(CSingleDialog)
- enum { IDD = D_SINGLE_EDIT };
- CSingRecord* m_pSet;
- //}}AFX_DATA
- char added[64];
- char cur_title[48];
- char deleted[64];
- struct INFO *first;
-
- // Implementation
- protected:
- CComboBox& List()
- {return *(CComboBox*)GetDlgItem(COM_SINGLE); }
- CButton& Undo()
- {return *(CButton*)GetDlgItem(BUT_STREET_UNDO); }
- virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
-
- // Generated message map functions
- //{{AFX_MSG(CSingleDialog)
- afx_msg void OnSingleAdd();
- afx_msg void OnSingleDel();
- afx_msg void OnSingleUndo();
- virtual void Redraw();
- virtual void OnOK();
- virtual void OnCancel();
- virtual int DeleteItem(char *);
- virtual int AddItem(char *);
- afx_msg void OnEditchangeSingle();
- virtual BOOL OnInitDialog();
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
- };
-
- class CRecviewSet : public CRecordset
- {
- DECLARE_DYNAMIC(CRecviewSet)
-
- public:
- CRecviewSet(CDatabase* pDatabase = NULL);
-
- // Field/Param Data
- //{{AFX_FIELD(CRecviewSet, CRecordset)
- //}}AFX_FIELD
-
- // Implementation
- protected:
- };
-
-
-
- (int talidoc.h)
-
- class CTaliDoc : public CDocument
- {
- protected: // create from serialization only
- CTaliDoc();
- DECLARE_DYNCREATE(CTaliDoc)
-
- // Attributes
- public:
- CSectionSet m_sectionSet;
- // Operations
- public:
-
- // Implementation
- public:
- virtual ~CTaliDoc();
- virtual void Serialize(CArchive& ar); // overridden for document i/o
- #ifdef _DEBUG
- virtual void AssertValid() const;
- virtual void Dump(CDumpContext& dc) const;
- #endif
-
- protected:
- virtual BOOL OnNewDocument();
-
- // Generated message map functions
- protected:
- //{{AFX_MSG(CTaliDoc)
- // NOTE - the ClassWizard will add and remove member functions
- here.
- // DO NOT EDIT what you see in these blocks of generated code!
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
- };
-
-
-
- (in tali.cpp)
-
- BOOL CSingleDialog::OnInitDialog()
- {
- char buffer[512];
- long i;
- struct INFO *temp;
-
- first = NULL;
- CTaliDoc * pDoc=(CTaliDoc *) (GetParentFrame()->GetActiveDocument());
- switch (SingleType) {
- case E_STREET:
- strcpy(cur_title,"Edit Street Table");
- //SetTitle(cur_title);
- m_pSet= &(pDoc->m_sectionSet);
- m_pSet->Open();
- List().LimitText(40);
- for(i=0;i<2000;i++) {
- sprintf(buffer,"%d",i);
- AddItem(buffer);
- }
- for(temp=first;temp;temp=temp->next) {
- temp->state='N';
- }
- break;
- default:
- break;
- }
- dbData.SetLoginTimeout(60);
- dbData.SetQueryTimeout(60);
- Undo().EnableWindow(FALSE);
- added[0]='\0';
- deleted[0]='\0';
-
- CDialog::OnInitDialog();
-
- return TRUE; // return TRUE unless you set the focus to a control
- }
-
-
-
- However, this gives me the following errors:
-
- Initializing...
- Compiling...
- c:\msvc\bin\tali\tali.cpp
- c:\msvc\bin\tali\talidoc.h(13) : error C2501: 'CSectionSet' : missing decl-
- specifiers
- c:\msvc\bin\tali\talidoc.h(13) : error C2146: syntax error : missing ';'
- before identifier 'm_sectionSet'
- c:\msvc\bin\tali\talidoc.h(13) : error C2501: 'm_sectionSet' : missing decl-
- specifiers
- c:\msvc\bin\tali\tali.cpp(1107) : error C2039: 'm_sectionSet' : is not a
- member of 'CTaliDoc'
- c:\msvc\bin\tali\talidoc.cpp
- c:\msvc\bin\tali\talidoc.h(13) : error C2501: 'CSectionSet' : missing decl-
- specifiers
- c:\msvc\bin\tali\talidoc.h(13) : error C2146: syntax error : missing ';'
- before identifier 'm_sectionSet'
- c:\msvc\bin\tali\talidoc.h(13) : error C2501: 'm_sectionSet' : missing decl-
- specifiers
- c:\msvc\bin\tali\taliview.cpp
- c:\msvc\bin\tali\talidoc.h(13) : error C2501: 'CSectionSet' : missing decl-
- specifiers
- c:\msvc\bin\tali\talidoc.h(13) : error C2146: syntax error : missing ';'
- before identifier 'm_sectionSet'
- c:\msvc\bin\tali\talidoc.h(13) : error C2501: 'm_sectionSet' : missing decl-
- specifiers
- CL returned error code 2.
- TALI.EXE - 10 error(s), 0 warning(s)
-
- Am I even going in the right direction?
-
- If anyone has sample code that I can look at or can explain what I can do to
- fix my current delema, I would greatly appreciate it.
-
-